package com.jsc.common.ExceptionHandler;

import com.jsc.common.response.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName BaseExceptionHandler
 * @Date 2021/6/28 0028 下午 13:47
 * @Author Administrator
 * @Description TODO
 * Version 1.0
 */
@Slf4j
@ControllerAdvice
public class BaseExceptionHandler {

    @ExceptionHandler(RuntimeException.class)
    @ResponseBody
    public Result error(Exception e) {
        log.error(e.getMessage());
        return new Result(false, StatusCode.ERROR, e.getMessage());
    }
}
